const routes = [
  {
    path: '/',
    component: () => import('layouts/MainLayout.vue'),
    children: [
      {path: '', component: () => import('pages/Index.vue')},
      {
        path: 'account',
        redirect: to => {
          return 'account/space';
        }
      },
      {path: 'account/register', component: () => import('pages/Account/Register.vue'), meta: { title: 'Register' }},
      {path: 'account/login', component: () => import('pages/Account/Login.vue'), meta: { title: 'Login' }},
      {path: 'account/space', component: () => import('pages/Account/Space.vue'), meta: { title: 'Space' }},
      {path: 'account/upload', component: () => import('pages/Account/Upload.vue'), meta: { title: 'Upload', guard: true }},
      {path: 'find/search', component: () => import('pages/Find/Search.vue'), meta: { title: 'Search' }},
      {path: 'video/:vid', component: () => import('pages/Video/Video.vue'), meta: { title: 'Video' }},
      {path: 'dashboard/log', component: () => import('pages/Dashboard/Log.vue'), meta: { title: 'Log' }},
      {path: 'dashboard/log/nginx', component: () => import('pages/Dashboard/NginxLog.vue'), meta: { title: 'Nginx Log' }}
    ]
  }
]

// Always leave this as last one
if (process.env.MODE !== 'ssr') {
  routes.push({
    path: '*',
    component: () => import('pages/Error404.vue')
  })
}

export default routes
